package de.uni.muenster.idw2.data;

import java.util.LinkedList;

import android.os.Parcel;
import android.os.Parcelable;

public class Room implements Parcelable{

	private double id;
	private String name;
	private String description;
	
	private LinkedList<Node> nodes = new LinkedList<Node>();
	private LinkedList<Node> innerNodes = new LinkedList<Node>();
	
	private LinkedList<Landmark> objects = new LinkedList<Landmark>();
	
	private LinkedList<Connection> connections = new LinkedList<Connection>();

	public Room(Parcel source){
		id = source.readDouble();
		name = source.readString();
		
		source.readTypedList(nodes, Node.CREATOR);
		source.readTypedList(innerNodes, Node.CREATOR);
		
		source.readTypedList(objects, Landmark.CREATOR);
		
		source.readTypedList(connections, Connection.CREATOR);
	}
	
	public Room(double id, String name) {
		super();
		this.id = id;
		this.name = name;
	}

	public double getId() {
		return id;
	}

	public void setId(double id) {
		this.id = id;
	}

	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}

	public LinkedList<Node> getNodes() {
		return nodes;
	}

	public void setNodes(LinkedList<Node> nodes) {
		this.nodes = nodes;
	}
	
	public void addNode(Node n){
		nodes.add(n);
	}

	public LinkedList<Node> getInnerNodes() {
		return innerNodes;
	}

	public void setInnerNodes(LinkedList<Node> innerNodes) {
		this.innerNodes = innerNodes;
	}
	
	public void addInnerNode(Node n){
		innerNodes.add(n);
	}

	public LinkedList<Landmark> getObjects() {
		return objects;
	}

	public void setObjects(LinkedList<Landmark> objects) {
		this.objects = objects;
	}
	
	public void addObject (Landmark o){
		this.objects.add(o);
	}

	public LinkedList<Connection> getConnections() {
		return connections;
	}

	public void setConnections(LinkedList<Connection> connections) {
		this.connections = connections;
	}
	
	public void addConnection(Connection c){
		connections.add(c);
	}

	@Override
	public int describeContents() {
		return 0;
	}
	
	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeDouble(id);
		dest.writeString(name);
		dest.writeTypedList(nodes);
		dest.writeTypedList(innerNodes);
		dest.writeTypedList(objects);
		dest.writeTypedList(connections);
		
	}
	
	public static final Parcelable.Creator CREATOR = new Creator() {

		@Override
		public Room createFromParcel(Parcel source) {
			return new Room(source);
		}

		@Override
		public Room[] newArray(int size) {
			return new Room[size];
		}
	};

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}
	
	
}
